<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>03_JS数据类型</title>
</head>
<body>
<script>
    //JS数据类型 = 原始类型 + 引用类型
    //原始类型: number string boolean undefined null
    //引用类型: object array function date...
    var a = 1;
    var b = 9.9;
    console.log(a,typeof a,b,typeof b);
    var c = 'hello';
    var d = "world";
    console.log(c,typeof c,d,typeof d);
    var e = true;
    var f = false;
    console.log(e,typeof e,f,typeof f);
    //声明了变量但未赋值,推断不出来数据类型,所以是未定义型undefined
    var g;
    console.log(g,typeof g);//undefined 'undefined'

    let obj = {};
    console.log(obj,typeof obj);
    obj.name = '张三';
    obj.age= 18;
    console.log(obj);

    let obj2 = {
        manba:'yao',
        curry:'克鲁l'
    };
    console.log(obj2);
    obj2.lebron = '科比';
    console.log(obj2);
    console.log(obj2.manba,obj2.curry,obj2.lebron);
    console.log(obj.mike);

    let arr = [7,7.1,'aaa','false'];
    console.log(arr,typeof arr);
    console.log(arr[0],arr[1],arr[2],arr[3]);
    console.log(arr.length);
    console.log(arr.hh);
    console.log(arr[100]);

    console.log(Number(true),typeof Number(true));
    console.log(Number(false));
    console.log(Number('123'));
    console.log(Number('23.5'));
    console.log(Number('hhh'));

    console.log(Boolean(0));
    console.log(Boolean(NaN));
    console.log(Boolean(''));
    console.log(Boolean(undefined));
    console.log(Boolean(null));
    console.log(Boolean('   '));
    console.log(Boolean('hdjkw'));
    console.log(Boolean('1'));




</script>
</body>
</html>